package org.wu.framework.authorization.platform.infrastructure.converter;

import org.wu.framework.authorization.platform.infrastructure.entity.SysMenuDO;
import org.wu.framework.authorization.platform.domain.model.sys.menu.SysMenu;
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructureConverter;

/**
 * describe
 *
 * @author Jia wei Wu
 * @date 2023/05/17 11:19 晚上
 * @see DefaultDDDLazyInfrastructureConverter
 **/

public class SysMenuConverter {


    /**
     * describe 实体对象 转换成领域对象
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysMenu toMenu(SysMenuDO sysMenuDO) {
        if (null != sysMenuDO) {
            SysMenu sysMenu = new SysMenu();
            sysMenu.setDesc(sysMenuDO.getDesc());
            sysMenu.setCode(sysMenuDO.getCode());
            sysMenu.setCreateTime(sysMenuDO.getCreateTime());
            sysMenu.setIcon(sysMenuDO.getIcon());
            sysMenu.setId(sysMenuDO.getId());
            sysMenu.setIframe(sysMenuDO.getIframe());
            sysMenu.setIsDeleted(sysMenuDO.getIsDeleted());
            sysMenu.setMenu(sysMenuDO.getMenu());
            sysMenu.setName(sysMenuDO.getName());
            sysMenu.setParentCode(sysMenuDO.getParentCode());
            sysMenu.setSort(sysMenuDO.getSort());
            sysMenu.setType(sysMenuDO.getType());
            sysMenu.setUpdateTime(sysMenuDO.getUpdateTime());
            sysMenu.setUrl(sysMenuDO.getUrl());
            sysMenu.setModule(sysMenuDO.getModule());
            return sysMenu;
        }
        return null;
    }

    /**
     * describe 领域对象 转换成实体对象
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysMenuDO fromMenu(SysMenu sysMenu) {
        if (null != sysMenu) {
            SysMenuDO sysMenuDO = new SysMenuDO();
            sysMenuDO.setDesc(sysMenu.getDesc());
            sysMenuDO.setCode(sysMenu.getCode());
            sysMenuDO.setCreateTime(sysMenu.getCreateTime());
            sysMenuDO.setIcon(sysMenu.getIcon());
            sysMenuDO.setId(sysMenu.getId());
            sysMenuDO.setIframe(sysMenu.getIframe());
            sysMenuDO.setIsDeleted(sysMenu.getIsDeleted());
            sysMenuDO.setMenu(sysMenu.getMenu());
            sysMenuDO.setName(sysMenu.getName());
            sysMenuDO.setParentCode(sysMenu.getParentCode());
            sysMenuDO.setSort(sysMenu.getSort());
            sysMenuDO.setType(sysMenu.getType());
            sysMenuDO.setUpdateTime(sysMenu.getUpdateTime());
            sysMenuDO.setUrl(sysMenu.getUrl());
            sysMenuDO.setModule(sysMenu.getModule());
            return sysMenuDO;
        }
        return null;
    }

}